<?php
if (!defined("IN_OP"))
{
    exit("You can't access this file directly...");
}
require_once( "class_3d/CheckMode_3d.php" );
$gametype = intval(getvar("gametype"));
$chk = new CheckMode_3d($curruser['acl'], 5, $gametype);
$chk->checkShow3dPage();
$show3D3S = $chk->show3D3S;
unset($chk);
$ui = new UI_3D(true);
$tpl = new Template2();
$conf = new Config();
include_once( "class_sb/MyLotto_sb.php" );
$MyLotto_sb = new MyLotto_sb($gametype);
$tbl = $g_gametype_3d[$gametype]['en'];
$tblName = $g_gametype_3d[$gametype]['ch'];
$page = getvar("page");
$page = $page == "" ? 1 : intval($page);
$ymdhis = date("Y-m-d H:i:s");
$rs = $MyLotto_sb->getDataList3s($page, 10, $show3D3S);
$showOpenTime = true;
$number = intval(getvar("number"));
if ($number == "")
{
    $number = 1;
}
if ($rs->eof)
{
    $list = "<tr><td colspan=41>目前无{$tblName}相关资料</td></tr>";
}
else
{
    $list = "<tbody id=\"tbdList\">";
    while (!$rs->eof)
    {
        $n3 = $rs->f['n3'] == 0 - 1 ? "" : $rs->f['n3'];
        $n2 = $rs->f['n2'] == 0 - 1 ? "" : $rs->f['n2'];
        $n1 = $rs->f['n1'] == 0 - 1 ? "" : $rs->f['n1'];
        $openFlag = $MyLotto_sb->checkOpen($rs->f['n3'], $rs->f['n2'], $rs->f['n1']);
        if ($showOpenTime)
        {
            $classStr = $ymdhis <= $rs->f['openbet'] && $rs->f['startbet'] <= $ymdhis ? "td6" : "td2";
        }
        else
        {
            $classStr = $rs->f['open'] == date("Y-m-d") ? "td6" : "td2";
        }
        $list .= "<tr class=\"" . $classStr . "\" align=\"center\">";
        $dateNum = date("w", strtotime($rs->f['open']));
        $list .= "<td nowrap>" . $rs->f['round'] . "</td>";
        $list .= "<td nowrap>" . $g_weekname[$dateNum] . "</td>";
        $list .= "<td  nowrap>" . $rs->f['open'] . "</td>";
        if ($showOpenTime)
        {
            $openbetIntTemp = strtotime($rs->f['openbet']);
            if (date("Y-m-d", $openbetIntTemp) != $rs->f['open'])
            {
                $list .= "<td nowrap class=\"td14\">";
            }
            else
            {
                $list .= "<td nowrap>";
            }
            $list .= date("H:i", $openbetIntTemp) . "</td>";
        }
        if (!empty($n1))
        {
            $list .= "<td nowrap><img src='skin/1/img/ball/" . intval($n3) . ".png' width='25'</td>";
            $list .= "<td nowrap><img src='skin/1/img/ball/" . intval($n2) . ".png' width='25'></td>";
            $list .= "<td nowrap><img src='skin/1/img/ball/" . intval($n1) . ".png' width='25'></td>";
			$list .= "<td>".($n1+$n2+$n3)."</td>";
			$list .= "<td>".$MyLotto_sb->showText($rs->f['bs'], "bs")."</td>";
        }
        else
        {
            $list .= "<td colspan=\"3\">&nbsp;</td>";
			$list .= "<td></td>";
			$list .= "<td>&nbsp;</td>";
        }
        $list .= "</tr>";
        $rs->movenext();
    }
    $list .= "</tbody>";
}
$tpl->load("main","result_sb.htm");
$tpl->set("list", $list);
$tpl->set("button", $rs->pagelink());
$tpl->set("gametype", "bgClc_{$gametype}");
$tpl->set("title_gametype", "bgImg_{$gametype}");
$tpl->set("gametypeStr", $tblName);
$tpl->set("chk" . $number, "checked");
$tpl->set("play_gametype", $gametype);

if ($showOpenTime)
{
    $tpl->set(array ("showOpenTimeTd" => "<td style=\"border-bottom-width=4px;\" rowspan=\"2\" width=\"1%\">开奖<br />时间</td>", "showOpenTimeTd02" => "<td>&nbsp;</td>", "note3s" => "<div>※开奖时间背景颜色为<span class=\"td14\">粉红色</span>时，代表已过凌晨(开奖日期 = 报表日期加一天)</div>"));
}
$jslink = "<script src=\"core/tpl/k2/jquery-1.4.2.min.js\"></script>\n";
$ui->set("jslink", $jslink);
$ui->set("csscode", ".ball3dBg{font-size:20px;} table td{font-size:13px;}");
$ui->header();
echo "<br />";
$tpl->show("main");
$ui->footer();